using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Net;
using System.IO;

namespace weather
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Forecast : System.Windows.Forms.Form
	{
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.MainMenu mainMenu1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.PictureBox pictureBox2;

		public Forecast()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			GetDoppler();
			pictureBox1.Size = pictureBox1.Image.Size;
			pictureBox2.Size = pictureBox2.Image.Size;
			//this.Size = pictureBox1.Size + pictureBox2.Size;
			//this.Height = this.Height + this.Height;
			//this.Width = this.Width - 40;
			this.Show();
			this.Activate();
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Forecast));
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.pictureBox2 = new System.Windows.Forms.PictureBox();
			this.SuspendLayout();
			// 
			// pictureBox1
			// 
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(336, 248);
			this.pictureBox1.TabIndex = 0;
			this.pictureBox1.TabStop = false;
			this.pictureBox1.Click += new System.EventHandler(this.Radar_Close);
			// 
			// pictureBox2
			// 
			this.pictureBox2.Location = new System.Drawing.Point(0, 248);
			this.pictureBox2.Name = "pictureBox2";
			this.pictureBox2.Size = new System.Drawing.Size(336, 264);
			this.pictureBox2.TabIndex = 1;
			this.pictureBox2.TabStop = false;
			this.pictureBox2.Click += new System.EventHandler(this.Radar_Close);
			// 
			// Forecast
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.BackColor = System.Drawing.SystemColors.Window;
			this.ClientSize = new System.Drawing.Size(296, 476);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.pictureBox2,
																		  this.pictureBox1});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "Forecast";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Forecast";
			this.TopMost = true;
			this.Closed += new System.EventHandler(this.Radar_Close);
			this.ResumeLayout(false);

		}
		#endregion

		public void GetDoppler() 
		{

			try
			{
				string url1 =  "http://9news.com/weather/images/wx-now.jpg";
				string url2 = "http://www.9news.com/weather/images/wx-planning.jpg";
				HttpWebRequest wr1 = (HttpWebRequest)WebRequest.Create(url1);
				HttpWebRequest wr2 = (HttpWebRequest)WebRequest.Create(url2);
				HttpWebResponse ws1 = (HttpWebResponse)wr1.GetResponse();
				HttpWebResponse ws2 = (HttpWebResponse)wr2.GetResponse();

				Stream str1 = ws1.GetResponseStream();
				Stream str2 = ws2.GetResponseStream();
				if( pictureBox1.Image != null )
					pictureBox1.Image.Dispose();
				pictureBox1.Image = Image.FromStream(str1);
				if( pictureBox2.Image != null )
					pictureBox2.Image.Dispose();
				pictureBox2.Image = Image.FromStream(str2);
				this.Text = "Forecast";
			}
			catch(Exception ex)
			{
				Console.WriteLine(ex.ToString());
			}
		}

		
		private void Radar_Close(object sender, System.EventArgs e)
		{
			this.Dispose();
		}

	}
}
